function [] = runPlotDynamicPredictions(runId)

%%% Add paths
addpath('../general_funcs');
addpath('../consumerAdoptions');
addpath('../providerAdoptions');
addpath('../providerExits');

%%% Get input / output paths
config = getConfig_jointProcess(runId);

% Get config_consumerAdoptions and config_providerAdoptions: necessary input for make_Xdynamic_xxx functions
indivConfigs.consumerAdoptions = getConfig_consumerAdoptions(config.runId_consumerAdoptions);
indivConfigs.providerAdoptions  = getConfig_providerAdoptions(config.runId_providerAdoptions);
indivConfigs.providerExits      = getConfig_providerExits(config.runId_providerExits);

indivRunFolders.providerAdoptions  = config.runFolder_providerAdoptions;
indivRunFolders.providerExits      = config.runFolder_providerExits;
indivRunFolders.consumerAdoptions = config.runFolder_consumerAdoptions;

myFolder = sprintf('%s/dynamicPredictions', config.runFolder);

%%% Load data from the 3 submodels
data = load_data_fullmodel(indivRunFolders);

%%% Get initial conditions (from base case) + Xdynamic_staticInputs
[initialConditions, ~] = load_base_initial_conditions_and_Xdynamic_staticInputs(indivRunFolders);

%%% Aggregate the data from spell level to day level to get day-level covariates
data.consumerAdoptions = aggregateCtsTimeData_consumerAdoptions(data.consumerAdoptions);
data.providerAdoptions  = aggregateCtsTimeData_providerAdoptions(data.providerAdoptions);
data.providerExits      = aggregateCtsTimeData_providerExits(data.providerExits);

%%% Read dimensions
T  = data.consumerAdoptions.dims.dims1{4};
K1 = data.consumerAdoptions.dims.dims1{5};
K2 = data.consumerAdoptions.dims.dims1{6};
K  = data.providerAdoptions.dims.dims1{3};

%%% Get true Y's
Ytrue.providerAdoptions = reshape(data.providerAdoptions.Y, [T K]); % T x K
Ytrue.providerExits     = reshape(data.providerExits.Y,     [T K]); % T x K
Ytrue.consumerAdoptions = reshape(data.consumerAdoptions.Y,       [T*K1 K2]); % (T*K1) * K2
Ytrue.consumerAdoptions = reshape(sum(Ytrue.consumerAdoptions,2), [T K1]); % T x K1

%%% Compute true and predicted installedBases over time
true_vals = compute_laggedBases(Ytrue, initialConditions, false);

%%% Aggregate across locations
true_aggVals = calc_Yagg(true_vals);


%%% Load predictions
predFile = sprintf('%s/pred_vals.mat', myFolder);
load(predFile, 'pred_vals', 'pred_aggVals', 'periodLabels', 'geoLabels');

%%% Produce time series plots
plot_predicted_timeseries(pred_aggVals.laggedConsumers,   true_aggVals.laggedConsumers,   sprintf('%s/timeseries_laggedConsumers.pdf',   myFolder), periodLabels, true, [0, 20000]);
plot_predicted_timeseries(pred_aggVals.laggedProviders,   true_aggVals.laggedProviders,   sprintf('%s/timeseries_laggedProviders.pdf',   myFolder), periodLabels, true);
plot_predicted_timeseries(pred_aggVals.consumerAdoptions, true_aggVals.consumerAdoptions, sprintf('%s/timeseries_consumerAdoptions.pdf', myFolder), periodLabels, true);
plot_predicted_timeseries(pred_aggVals.providerAdoptions, true_aggVals.providerAdoptions, sprintf('%s/timeseries_providerAdoptions.pdf', myFolder), periodLabels, true);
plot_predicted_timeseries(pred_aggVals.providerExits,     true_aggVals.providerExits,     sprintf('%s/timeseries_providerExits.pdf',     myFolder), periodLabels, true);

end
